#include <cstring>
#include <cassert>

template <typename T>
static void FillZeros(T *ptr, size_t counts) {
    memset(ptr, 0x00, sizeof(T)*counts);
}

static void write_outbound() {
    int *pi = new int[10];
    FillZeros(pi, 11);
    delete[] pi;
}

static void read_outbound() {
    int *pi = new int[10] {1,2,3,4,5,6,7,8,9,10};

    int sum = 0;

    for (int i=0; i<=10; ++i) {
        sum += pi[i];
    }
}


static void advance() {
    class MyClass {
        unsigned long long data[100];
        int  *ptr = nullptr;

    public:
        ~MyClass() {
            delete ptr;
        }

        void foo() {
            delete ptr;
            ptr = new int[100];
        }

        unsigned long long *get_data() {
            return data;
        }

        static int get_buffer_size() {
            return sizeof(data) / sizeof(*data);
        }
    };

    MyClass *cls = new MyClass;
    cls->foo();

    auto const fill_fab = [](unsigned long long *pdata, int size) {
        if (size >= 2) {
            pdata[0] = pdata[1] = 1;
        } else if (size == 1) {
            pdata[0] = 1;
        } else if (size <= 0)
            return;
        for (int i=2; i<=size; ++i) {
            pdata[i] = pdata[i-1] + pdata[i-2];
        }
    };

    fill_fab(cls->get_data(), cls->get_buffer_size());
    delete cls;
}

int main() {
    write_outbound();
    read_outbound();
    advance();
}